<?php



/**
 * This class defines the structure of the 'car_data' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    propel.generator.damages.map
 */
class DamagesCarDataTableMap extends TableMap
{

    /**
     * The (dot-path) name of this class
     */
    const CLASS_NAME = 'damages.map.DamagesCarDataTableMap';

    /**
     * Initialize the table attributes, columns and validators
     * Relations are not initialized by this method since they are lazy loaded
     *
     * @return void
     * @throws PropelException
     */
    public function initialize()
    {
        // attributes
        $this->setName('car_data');
        $this->setPhpName('CarData');
        $this->setClassname('DamagesCarData');
        $this->setPackage('damages');
        $this->setUseIdGenerator(true);
        // columns
        $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, 4, null);
        $this->addForeignKey('DEALER_ID', 'DealerId', 'INTEGER', 'dealers', 'ID', false, 4, null);
        $this->addForeignKey('DEALER_PARENT_ID', 'DealerParentId', 'INTEGER', 'dealers', 'ID', false, 4, null);
        $this->addForeignKey('DICT_BRAND_ID', 'DictBrandId', 'INTEGER', 'dict_brands', 'ID', true, 4, null);
        $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null);
        $this->addColumn('COMISSION_NO', 'ComissionNo', 'VARCHAR', true, 45, null);
        $this->addColumn('VIN', 'Vin', 'VARCHAR', true, 45, null);
        $this->addColumn('LOCKED', 'Locked', 'TINYINT', true, 1, 0);
        $this->addColumn('CREATED', 'Created', 'TIMESTAMP', true, 16, null);
        $this->addColumn('MODIFIED', 'Modified', 'TIMESTAMP', false, 16, null);
        // validators
    } // initialize()

    /**
     * Build the RelationMap objects for this table relationships
     */
    public function buildRelations()
    {
        $this->addRelation('DictBrands', 'DamagesDictBrands', RelationMap::MANY_TO_ONE, array('dict_brand_id' => 'id', ), null, null);
        $this->addRelation('DealersRelatedByDealerId', 'DamagesDealers', RelationMap::MANY_TO_ONE, array('dealer_id' => 'id', ), null, null);
        $this->addRelation('DealersRelatedByDealerParentId', 'DamagesDealers', RelationMap::MANY_TO_ONE, array('dealer_parent_id' => 'id', ), null, null);
        $this->addRelation('CarDamages', 'DamagesCarDamages', RelationMap::ONE_TO_MANY, array('id' => 'car_data_id', ), null, null, 'CarDamagess');
    } // buildRelations()

} // DamagesCarDataTableMap
